#pragma once


#include <windows.h>
#include <stdio.h>
#include "aeffectx.h"
#include "VstDlg.h"

typedef AEffect* (*PluginEntryProc) (audioMasterCallback audioMaster);

class CWavVstHost
{
public:
	CWavVstHost(void);
	~CWavVstHost(void);
protected:
	void* module;
	AEffect* effect;
	PluginEntryProc mainProc;
	VstInt32 kBlockSize;
	float kSampleRate;
	VstInt32 numInputs;
	VstInt32 numOutputs;
	float** inputs;
	float** outputs;
	CVstDlg* m_pEditorDlg;
	long m_nPrograms;
	int m_AvgBytePerSample;
public:
	BOOL Load(char* fileName);
	void Close(void);
	void SetBuffer(DWORD SampleRate, DWORD BufferSize, int AvgBitPerSample=16);
	void Process(PVOID pBuffer,DWORD BufferSize = 0);
	void Process(float* pLChannel,float* pRChannel,DWORD BufferSize = 0);
	void OpenEditorDlg(CWnd* hwndParent);
	void CloseEditorDlg();
	
	long SetProgram(long n);
	void SetProgramName(char* Name);
	long GetProgram(void);
	void GetProgramName(char* Name);
	long GetProgramCount(void);
};